/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrmPrincipal.java
 *
 * Created on 23/07/2011, 10:28:10
 */
package siscom.frames;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import siscom.componentes.SisFrame;
import siscom.util.Util;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author Carlos Ribeiro
 */
public class FrmPrincipal extends SisFrame {

    /** Creates new form FrmPrincipal */
    public FrmPrincipal() {
        initComponents();
        setTitle("SisCOM - ");
        try {
            UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
        } catch (ClassNotFoundException ex) {
            Util.trataErro(ex);
        } catch (InstantiationException ex) {
            Util.trataErro(ex);
        } catch (IllegalAccessException ex) {
            Util.trataErro(ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Util.trataErro(ex);
        }
        SwingUtilities.updateComponentTreeUI(this);
        KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
        getRootPane().getInputMap().put(stroke, "ESCAPE");
        getRootPane().getActionMap().put("ESCAPE", new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent e) {
                System.exit(0);
            }
        });
    }

    public static void main(String[] args) {
        new FrmPrincipal().setVisible(true);
    }
    
    public void close() {
        System.exit(0);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        toolBar = new javax.swing.JToolBar();
        tbBtnProdutos = new javax.swing.JButton();
        tbBtnComandas = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        menuCadastros = new javax.swing.JMenu();
        itemCadProdutos = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();

        toolBar.setRollover(true);

        tbBtnProdutos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/siscom/icones/carton_64.png"))); // NOI18N
        tbBtnProdutos.setMnemonic('p');
        tbBtnProdutos.setText("Produtos");
        tbBtnProdutos.setToolTipText("Cadastro de Produtos");
        tbBtnProdutos.setFocusable(false);
        tbBtnProdutos.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        tbBtnProdutos.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        tbBtnProdutos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tbBtnProdutosActionPerformed(evt);
            }
        });
        toolBar.add(tbBtnProdutos);

        tbBtnComandas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/siscom/icones/table-64.png"))); // NOI18N
        tbBtnComandas.setMnemonic('C');
        tbBtnComandas.setText("Comandas");
        tbBtnComandas.setFocusable(false);
        tbBtnComandas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        tbBtnComandas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        tbBtnComandas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tbBtnComandasActionPerformed(evt);
            }
        });
        toolBar.add(tbBtnComandas);

        menuCadastros.setMnemonic('C');
        menuCadastros.setText("Cadastro");
        menuCadastros.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuCadastrosActionPerformed(evt);
            }
        });

        itemCadProdutos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/siscom/icones/carton_32.png"))); // NOI18N
        itemCadProdutos.setMnemonic('p');
        itemCadProdutos.setText("Produtos");
        itemCadProdutos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemCadProdutosActionPerformed(evt);
            }
        });
        menuCadastros.add(itemCadProdutos);

        menuBar.add(menuCadastros);

        jMenu2.setText("Edit");
        menuBar.add(jMenu2);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(toolBar, javax.swing.GroupLayout.DEFAULT_SIZE, 1024, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(525, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void menuCadastrosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuCadastrosActionPerformed
        
    }//GEN-LAST:event_menuCadastrosActionPerformed

    private void itemCadProdutosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemCadProdutosActionPerformed
        new FrmCadProdutos().setVisible(true);
    }//GEN-LAST:event_itemCadProdutosActionPerformed

    private void tbBtnProdutosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbBtnProdutosActionPerformed
        
    }//GEN-LAST:event_tbBtnProdutosActionPerformed

    private void tbBtnComandasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbBtnComandasActionPerformed
        new FrmComandas().setVisible(true);
    }//GEN-LAST:event_tbBtnComandasActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem itemCadProdutos;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenu menuCadastros;
    private javax.swing.JButton tbBtnComandas;
    private javax.swing.JButton tbBtnProdutos;
    private javax.swing.JToolBar toolBar;
    // End of variables declaration//GEN-END:variables
}
